<template>
    <div>
        <h3>登录列表</h3>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>用户名</td>
                    <td>
                        <input type="text" v-model="deng.name">
                    </td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td>
                        <input type="password" v-model="deng.mima">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="登录" class="btn btn-primary" @click="ok">
                    </td>
                </tr>
                <!-- kkkkk -->
            </tbody>
        </table>
    </div>
    <!-- 考试计划 -->
</template>

<script setup lang="ts">
import {ref,reactive} from 'vue'
import axios from 'axios';
import{useRoute,useRouter} from 'vue-router'
const  route=useRoute();
const  router=useRouter();

let deng=reactive({
        name:'',
        mima:''
})
const ok=()=>{
    axios({
        url:'/api/deng/denglu',
        method:'get',
        params:deng
    })
    .then((res)=>{
        console.log(res);
        if(res.data==-1)
    {
        alert('用户名不存在');
        return 
    }
    else if(res.data==-2)
    {
        alert('密码错误');
        return
    }
    else{
        alert('登录成功');
    }
    })
    .catch((err)=>{
        console.log(err);
    })
}
</script>

<style scoped>

</style>